package com.qf.sys.service.impl;

import com.github.pagehelper.PageInfo;
import com.qf.sys.dao.UserDao;
import com.qf.sys.po.User;
import com.qf.sys.service.UserService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * @创建人 sunsir Email:sunsir163@163.com
 * @创建时间 2022/5/6
 * @描述
 */
@Service
public class UserServiceImpl implements UserService {
    @Resource
    UserDao userDao;

    public User getUserById(int id) {
        return userDao.getUserById(id);
    }
    public User getUserByLoginName(String loginName){
        return userDao.getUserByLoginName(loginName);
    }

    public PageInfo<User> getUserList(Map params) {
        List<User> userList= userDao.getUserList(params);
        PageInfo<User> pageInfo = new PageInfo<User>(userList);
        return pageInfo;
    }


    public boolean addUser(Map params) {
        boolean f=userDao.addUser(params) > 0?true:false;
        return f;
    }


    public boolean updateUser(User user) {
        return userDao.updateUser(user) > 0;
    }


    public boolean deleteUser(int id) {
        return userDao.deleteUser(id) > 0;
    }

    @Override
    public boolean upadteUserstatusTo0(int empNo) {
        return  userDao.upadteUserstatusTo0(empNo);
    }
    @Override
    public boolean upadteUserstatusTo1(int empNo) {
        return  userDao.upadteUserstatusTo1(empNo);
    }



}
